package com.vstudy.zx.controller;

import com.vstudy.zx.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class RegisterController {
    @Autowired
    private TeacherService service;

    @RequestMapping(value = "/register", method = RequestMethod.POST)
    public String register(String realName, String username, String password) {
        Boolean res = service.register(realName, username, password);
        if (res) {
            return "redirect:/login";
        } else {
            return "register.jsp";
        }

    }
}
